package com.auto.api.common.entity;

import com.auto.api.common.utils.BeanMapper;
import java.io.Serializable;
import java.util.List;

/**
 * @program:
 * @description: 集合对象
 * @author: liangshf
 * @create: 2022-01-07
 */
public class ListData<T> implements Serializable {

    private static final long serialVersionUID = 9057406277763703651L;

    private List<T> list;

    public ListData() {
    }

    public ListData(final List<T> list) {
        this.list = list;
    }

    public List<T> getList() {
        return this.list;
    }

    public void setList(final List<T> list) {
        this.list = list;
    }

    public static <E> ListData<E> newList(List<E> list) {
        return new ListData(list);
    }

    public <E> ListData<E> listMap(Class<E> clazz) {
        ListData<E> result = (ListData<E>) this;
        result.setList(BeanMapper.mapList(this.getList(), clazz));
        return result;
    }

}